﻿@* 
Project: Aguafrommars/TheIdServer
Copyright (c) 2022 @Olivier Lefebvre
*@
@page
@inject IViewLocalizer Localizer
@model RegisterModel
@{
    ViewData["Title"] = Localizer["Register"];
}

<h2>@ViewData["Title"]</h2>

<div class="row">
    <div class="col-md-4">
        <form asp-route-returnUrl="@Model.ReturnUrl" method="post">
            <h4>@Localizer["Create a new account."]</h4>
            <hr />
            <div asp-validation-summary="All" class="text-danger"></div>
            <div class="form-floating mb-2">
                <input asp-for="Input.Email" class="form-control" />
                <label asp-for="Input.Email" class="form-label"></label>
                <span asp-validation-for="Input.Email" class="text-danger"></span>
            </div>
            <div class="form-floating mb-2">
                <input asp-for="Input.Password" class="form-control" />
                <label asp-for="Input.Password" class="form-label"></label>
                <span asp-validation-for="Input.Password" class="text-danger"></span>
            </div>
            <div class="form-floating mb-2">
                <input asp-for="Input.ConfirmPassword" class="form-control" />
                <label asp-for="Input.ConfirmPassword" class="form-control"></label>
                <span asp-validation-for="Input.ConfirmPassword" class="text-danger"></span>
            </div>
            <button type="submit" class="w-100 btn btn-lg btn-primary">@Localizer["Register"]</button>
        </form>
    </div>
    @if ((Model.ExternalLogins?.Count ?? 0) > 0)
    {
        <div class="col-md-6 col-md-offset-2">
            <section>
                <h4>@Localizer["Use another service to register."]</h4>
                <hr />
                <form id="external-account" asp-page="./ExternalLogin" asp-route-returnUrl="@Model.ReturnUrl" method="post" class="form-horizontal">
                    <div>
                        <p>
                            @foreach (var provider in Model.ExternalLogins)
                            {
                                <button type="submit" class="btn btn-lg  btn-secondary  mb-2" name="provider" value="@provider.Name" title="@Localizer["Log in using your {0} account", provider.DisplayName]">@provider.DisplayName</button>
                            }
                        </p>
                    </div>
                </form>
            </section>
        </div>
    }
</div>

@section Scripts {
    <partial name="_ValidationScriptsPartial" />
}
